home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WCOLOR.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  5.7 KB  |  208 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WColor -- Wrapper for the Windows 95 Color object.
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WCOLOR_HPP_INCLUDED
  18. #define _WCOLOR_HPP_INCLUDED
  19. #pragma once
  20.  
  21. #ifndef _WNO_PRAGMA_PUSH
  22. #pragma pack(push,8);
  23. #pragma enum int;
  24. #endif
  25.  
  26. #ifndef _WOBJECT_HPP_INCLUDED
  27. #  include "wobject.hpp"
  28. #endif
  29. #ifndef _WARRAY_HPP_INCLUDED
  30. #  include "warray.hpp"
  31. #endif
  32.  
  33. enum WColorValue {
  34.  
  35.     /**********************************************************
  36.      * Special Color Values
  37.      *********************************************************/
  38.          
  39.     WColorInherited = -2,
  40.     WColorRGB  = -1,
  41.  
  42.     WColorNull =  0,
  43.     WColorDefault = WColorNull,
  44.  
  45.     /**********************************************************
  46.      * Normal Color Values
  47.      *********************************************************/
  48.          
  49.     WColorBrightRed,
  50.     WColorFirst = WColorBrightRed,
  51.     WColorBrightGreen,
  52.     WColorBrightBlue,
  53.     WColorRed,
  54.     WColorGreen,
  55.     WColorBlue,
  56.     WColorBlack,
  57.     WColorWhite,
  58.     WColorDarkGray,
  59.     WColorLightGray,
  60.     WColorBrightPink,
  61.     WColorPink,
  62.     WColorBrightYellow,
  63.     WColorYellow,
  64.     WColorBrightCyan,
  65.     WColorCyan,
  66.     WColorLast = WColorCyan,
  67.  
  68.     /**********************************************************
  69.      * System Color Values
  70.      *********************************************************/
  71.  
  72.     WColorMenu,
  73.                 WColorSystemFirst = WColorMenu,
  74.     WColorMenuText,
  75.     WColorWindow,
  76.     WColorWindowText,
  77.     WColorWindowFrame,
  78.     WColorBtnHighlight,
  79.                 WColorBtnHilight = WColorBtnHighlight,
  80.                 WColor3DHighlight = WColorBtnHighlight,
  81.                 WColor3DHilight = WColorBtnHilight,
  82.     WColorBtnFace,
  83.                 WColor3DFace = WColorBtnFace,
  84.     WColorBtnShadow,
  85.                 WColor3DShadow = WColorBtnShadow,
  86.     WColorTextBox,
  87.                 WColorEditBox = WColorTextBox,
  88.     WColorDialogBackground,
  89.     WColorBackground,
  90.                 WColorDesktop = WColorBackground,
  91.     WColorScrollbar,
  92.     WColorGrayText,
  93.     WColorActiveBorder,
  94.     WColorInactiveBorder,
  95.     WColorAppWorkSpace,
  96.     WColorActiveCaption,
  97.     WColorInactiveCaption,
  98.     WColorCaptionText,
  99.     WColorInactiveCaptionText,
  100.     WColorHighlight,
  101.     WColorHighlightText,
  102.     WColorInfoText,
  103.     WColorInfoBack,
  104.     WColor3DDarkShadow,
  105.     WColor3DLight,
  106.     WColorBtnText,
  107.  
  108.     WColorSystemLastPlusOne,
  109.     WColorSystemLast = WColorSystemLastPlusOne - 1,
  110.  
  111.     /**********************************************************
  112.      * Special Color Value
  113.      *********************************************************/
  114.  
  115.     // forces enum to a long
  116.  
  117.     WColorEnd = 66000
  118.  
  119. };
  120.  
  121. typedef WULong WRGBValue;
  122.  
  123. class WCMCLASS WColor : public WObject {
  124.     WDeclareSubclass( WColor, WObject );
  125.  
  126.     public:
  127.  
  128.         /**********************************************************
  129.          * Constructors and Destructors
  130.          *********************************************************/
  131.  
  132.         WColor( WColorValue col=WColorDefault );
  133.         WColor( const WColor & color );
  134.         WColor( WUChar red, WUChar green, WUChar blue );
  135.  
  136.         ~WColor();
  137.  
  138.         WColor & operator=( const WColor & );
  139.  
  140.         // Equality
  141.  
  142.         int operator==( const WColor & color ) const;
  143.         int operator!=( const WColor & color ) const;
  144.  
  145.         /**********************************************************
  146.          * Properties
  147.          *********************************************************/
  148.  
  149.         // ColorValue
  150.  
  151.         WColorValue GetColorValue() const { return _value; }
  152.         WBool       SetColorValue( WColorValue value );
  153.  
  154.         // RGB
  155.  
  156.         WBool     SetRGB( WRGBValue val );
  157.         WBool     SetRGB( WUChar red, WUChar green, WUChar blue );
  158.         WRGBValue GetRGB() const;
  159.  
  160.         // Red
  161.  
  162.         WBool  SetRed( WUChar red );
  163.         WUChar GetRed() const;
  164.  
  165.         // Green
  166.  
  167.         WBool  SetGreen( WUChar green );
  168.         WUChar GetGreen() const;
  169.  
  170.         // Blue
  171.  
  172.         WBool  SetBlue( WUChar blue );
  173.         WUChar GetBlue() const;
  174.  
  175.         /**********************************************************
  176.          * Methods
  177.          *********************************************************/
  178.  
  179.         // Create
  180.  
  181.         WBool Create( WColorValue col=WColorDefault );
  182.         WBool Create( const WColor & color );
  183.         WBool Create( WUChar red, WUChar green, WUChar blue );
  184.  
  185.         // ResetSystemColors
  186.  
  187.         static void ResetSystemColors();
  188.  
  189.         /**********************************************************
  190.          * Data members
  191.          *********************************************************/
  192.  
  193.     private:
  194.         WColorValue  _value;
  195.         WRGBValue    _rgbValue; // valid only if _value is WColorRGB
  196. };
  197.  
  198. extern template WArrayReference<WColor>;
  199. extern template WArray<WColor>;
  200. typedef WArray<WColor>                  WColorArray;
  201.  
  202. #ifndef _WNO_PRAGMA_PUSH
  203. #pragma enum pop;
  204. #pragma pack(pop);
  205. #endif
  206.  
  207. #endif // _WCOLOR_HPP_INCLUDED
  208.